The volcano3D package enables exploration of probes differentially expressed between three groups. Its main purpose is for the visualisation of differentially expressed genes in a three-dimensional volcano plot. These plots can be converted to interactive visualisations using plotly.
This vignette consists of a case study from the PEAC rheumatoid arthritis project (Pathobiology of Early Arthritis Cohort). The methodology has been published in Lewis, Myles J., et al. ‘Molecular portraits of early rheumatoid arthritis identify clinical and treatment response phenotypes.’ Cell reports 28.9 (2019): 2455-2470. (DOI: 10.1016/j.celrep.2019.07.091) with an interactive web tool available at https://peac.hpc.qmul.ac.uk.
There are also supplementary vignettes with further information on:
Variables used in this vignette:
| Variable | Definition |
|---|---|
| contrast | the variable by which samples can be split into three groups. |
| groups | the three levels/categories of the contrast variable. These should not contain underscores. |
| comparison | two groups between which a statistical test can be performed. There should be three comparisons total. For the examples outlined in this vignette we look at comparisons: ‘lymphoid-myeloid’, ‘lymphoid-fibroid’ and ‘myeloid-fibroid’. |
| p | p value |
| FC | fold change |
| padj | adjusted p value |
| suffix | the tail word in a column name. In this package it states the statistical parameter (e.g. _logFC is the log FC variable). |
| prefix | the leading word in a column name. In this package it states the statistical test (e.g. LRT is the likelihood ratio test). |
| polar | A polar coordinates object, of S4 class, containing the expression data, sample data, pvalues and polar coordinates. |
This vignette will demonstrate the power of this package using a basic example from the PEAC data set. Here we will focus on the synovial data from this cohort.
Using the synovial biopsies from PEAC we can create a polar object for differentially expressed genes. The sample data used in this vignette can be loaded from the volcano3Ddata package.
First we will set up a polar object, using the polar_coords function, which uses:
| Variable | Details |
|---|---|
|
sampledata (required) |
This shows information for each sample in rows and must contain:
|
|
contrast (required) |
The column name in sampledata which contains the three-level factor used for contrast |
|
pvalues (required) |
the pvalues data.frame which contains the statistical significance of probes between groups. This contains:
|
|
expression (required) |
A data frame or matrix containing the expression data. This is used to calculate z-score and fold change, therefore it should be a normalised expression object such as log transformed or variance stabilised. |
| groups |
The groups to be compared (in order). If NULL this defaults to levels(sampledata[, 'contrasts']). These must not contain underscores.
|
| p_col_suffix | The suffix of column names with pvalues (default is ‘pvalue’). This must not contain underscores. |
| padj_col_suffix |
The suffix of column names with adjusted pvalues (default is ‘padj’). This must not contain underscores. If NULL the adjusted pvalue is calculated using p_col_suffix and pvalue_method.
|
| padjust_method | The method to calculate adjusted pvalues if not already provided. Must be one of c(‘holm’, ‘hochberg’, ‘hommel’, ‘bonferroni’, ‘BH’, ‘BY’, ‘fdr’, ‘none’). Default is ‘BH’. |
| fc_col_suffix | The suffix of column names with log(fold change) values (default is ‘logFC’). This must not contain underscores. |
| multi_group_prefix | The prefix for columns containing statistics for a multi-group test (this is typically a likelihood ratio test or ANOVA). Default is NULL. This must not contain underscores. |
| label_column | A column name in pvalues which is to be used to label markers of interest at plotting stage. If NULL the rownames will be used. |
For example we can map the PEAC data to polar coordinates using:
syn_pvalues$Fibroid_Lymphoid_pvalue = factor(syn_pvalues$Fibroid_Lymphoid_pvalue)
syn_polar <- polar_coords(sampledata = syn_metadata,
contrast = "Pathotype",
pvalues = syn_pvalues,
expression = syn_rld,
p_col_suffix = "pvalue",
padj_col_suffix = "padj",
fc_col_suffix = "log2FoldChange",
multi_group_prefix = "LRT",
non_sig_name = "Not Significant",
significance_cutoff = 0.01,
label_column = NULL,
fc_cutoff = 0.1)The produces a polar object with a pvalues slot which should have at least two statistics for each comparison - pvalue and adjusted pvalue - with an optional logarithmic fold change statistic. In this case we are including fold change for downstream visualisations:
| Fibroid_Lymphoid _pvalue | Fibroid_Lymphoid _logFC | Fibroid_Lymphoid _padj | Lymphoid_Myeloid _pvalue | Lymphoid_Myeloid _logFC | Lymphoid_Myeloid _padj | Myeloid_Fibroid _pvalue | Myeloid_Fibroid _logFC | Myeloid_Fibroid _padj | LRT _pvalue | LRT _padj | label | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| A2M | 7.775361e-01 | -0.0478326 | 1 | 0.1563045 | -0.2202768 | 1.0000000 | 0.1694654 | 0.2681094 | 1 | 0.2739571 | 0.4353436 | A2M |
| A2ML1 | 2.105896e-04 | 1.6854024 | 1 | 0.0000030 | -1.9299687 | 0.0464724 | 0.6348844 | 0.2445664 | 1 | 0.0000022 | 0.0000202 | A2ML1 |
| A4GALT | 1.085321e-12 | 1.0248506 | 0 | 0.0000192 | -0.5646665 | 0.2927492 | 0.0055222 | -0.4601841 | 1 | 0.0000000 | 0.0000000 | A4GALT |
| A4GNT | 2.383018e-02 | -1.1527859 | 1 | 0.6691773 | -0.1857435 | 1.0000000 | 0.0197330 | 1.3385294 | 1 | 0.0732984 | 0.1583022 | A4GNT |
| AAAS | 8.574281e-01 | -0.0245296 | 1 | 0.6608837 | 0.0548697 | 1.0000000 | 0.8469982 | -0.0303402 | 1 | 0.9075226 | 0.9711813 | AAAS |
| AACS | 2.815302e-01 | 0.1729592 | 1 | 0.0630182 | -0.2732040 | 1.0000000 | 0.5874802 | 0.1002448 | 1 | 0.1472059 | 0.2732939 | AACS |
The sig column in syn_polar@polar allows us to determine relative differences in expression between groups (in this case pathotypes). The ‘+’ indicates which pathotypes are significantly ‘up’ compared to others. For example:
genes labelled ‘Lymphoid+’ are significantly up in Lymphoid vs Myeloid and Lymphoid vs Fibroid.
genes up in two pathotypes such as ‘Lymphoid+Myeloid+’ are up in both Lymphoid and Myeloid, therefore Lymphoid vs Fibroid and Myeloid vs Fibroid are statistically significant.
genes which show no significant difference between pathotypes are classed according to non_sig_name
This gives us:
| Significance | Frequency |
|---|---|
| Fibroid+ | 885 |
| Fibroid+Lymphoid+ | 19 |
| Fibroid+Myeloid+ | 1504 |
| Lymphoid+ | 1793 |
| Lymphoid+Myeloid+ | 500 |
| Myeloid+ | 119 |
| Not Significant | 11415 |
If there is a fold change column previously provided, we can now investigate the comparisons between pathotypes using the volcano_trio function. This creates three ggplot outputs.
syn_plots <- volcano_trio(polar = syn_polar,
sig_names = c("not significant","significant",
"not significant","significant"),
colours = rep(c("grey60", "slateblue1"), 2),
text_size = 9,
marker_size=1,
shared_legend_size = 0.9,
label_rows = c("SLAMF6", "PARP16", "ITM2C"),
fc_line = FALSE,
share_axes = FALSE)
syn_plots$AllThe differential expression can now be visualised on an interactive radar plot using radial_plotly. The labelRows variable allows any markers of interest to be labelled.
By hovering over certain points you can also determine genes for future interrogation.
Similarly we can create a static ggplot image using radial_ggplot:
radial_ggplot(polar = syn_polar,
label_rows = c("SLAMF6", "FMOD"),
marker_size = 2.3,
legend_size = 10) +
theme(legend.position = "right")Alternatively a continuous colour scale can be produced by converting the angle to a hsv variable. This angle can be offset by continuous_shift.
radial_ggplot(polar = syn_polar,
label_rows = c("SLAMF6", "PARP16", "ITM2C"),
marker_size = 2.3,
marker_alpha=0.7,
colour_scale = "continuous",
continuous_shift=1.33,
legend_size = 10) We can then interrogate any one specific variable as a boxplot, to investigate these differences. This is build using ggplot2 so can easily be edited by the user to add features. Using plotly:
plot1 <- boxplot_trio(syn_polar,
value = "FAM92B",
text_size = 7,
test = "polar_padj",
levels_order = c("Lymphoid", "Myeloid", "Fibroid"),
box_colours = c("blue", "red", "green3"),
step_increase = 0.2,
plot_method='plotly')
plot2 <- boxplot_trio(syn_polar,
value = "SLAMF6",
text_size = 7,
test = "polar_multi_padj",
levels_order = c("Lymphoid", "Myeloid", "Fibroid"),
box_colours = c("blue", "red", "green3"),
plot_method='plotly')
plot3 <- boxplot_trio(syn_polar,
value = "PARP16",
text_size = 7,
stat_size=2.5,
test = "t.test",
levels_order = c("Myeloid", "Fibroid"),
box_colours = c("pink", "gold"),
plot_method='plotly')
plotly::subplot(plot1, plot2, plot3, titleY=TRUE, margin=0.05)Or using ggplot
plot1 <- boxplot_trio(syn_polar,
value = "FAM92B",
text_size = 7,
test = "polar_padj",
levels_order = c("Lymphoid", "Myeloid", "Fibroid"),
box_colours = c("blue", "red", "green3"),
step_increase = 0.1)
plot2 <- boxplot_trio(syn_polar,
value = "SLAMF6",
text_size = 7,
test = "polar_multi_padj",
levels_order = c("Lymphoid", "Myeloid", "Fibroid"),
box_colours = c("blue", "red", "green3"))
plot3 <- boxplot_trio(syn_polar,
value = "PARP16",
text_size = 7,
stat_size=2.5,
test = "t.test",
levels_order = c("Myeloid", "Fibroid"),
box_colours = c("pink", "gold"))
ggarrange(plot1, plot2, plot3, ncol=3)The final thing we can look at is the 3D volcano plot which projects differential gene expression onto cylindrical coordinates.
p <- volcano3D(syn_polar,
label_rows = c("SLAMF6", "PARP16", "ITM2C"),
label_size = 10,
xy_aspectratio = 1,
z_aspectratio = 0.9,
plot_height = 800)
p Again this produces an interactive plot. If you have the orca command-line utility installed, this can be used to save static images. To install follow the instructions here.
We can alter the colours using the colours parameter. These are assigned in order group1+, group1+group2+, group2+, group2+group3+, group3+, group1+group3+.
By default volcano3D generates a grid using 12 spokes. If you wish to override any of these variables it is possible to pass in your own grid. This is also possible for the 3D radial plots where the z elements can be left as NULL.
By manually creating a grid object it is possible to change the tick points on axes as well as the number of radial spokes (n_spokes).
The default ticks are calculated from r_vector and z_vector using the pretty function. This can be overwritten by passing tick points in r_axis_ticks and z_axis_ticks.
For example we can decrease the number of radial spokes to 4, while altering the z axis ticks:
four_grid = polar_grid(r_vector=syn_polar@polar$r_zscore,
z_vector=NULL,
r_axis_ticks = NULL,
z_axis_ticks = c(0, 8, 16, 32),
n_spokes = 4)We can inspect the grid using show_grid() which creates both the polar and cylindrical coordinate system:
and pass it into the plotting functions:
volcano3D(syn_polar,
grid = four_grid,
label_rows = c("SLAMF6", "PARP16", "ITM2C"),
label_size = 10,
xy_aspectratio = 1,
z_aspectratio = 0.9)For example to extend the radial axis and increasing the number of spokes in 2D we can apply:
By default the rownames of the pvalues object is used to label markers of interest. This can be altered by amending the label column in the polar object:
syn_polar@polar$label <- paste0(syn_polar@polar$label, "!")
radial_ggplot(polar = syn_polar,
label_rows = c("SLAMF6", "PARP16", "ITM2C"),
grid = new_grid,
marker_size = 2.3,
legend_size = 10) +
theme(legend.position = "right")We can then collapse this into a modular analysis using a list of gene sets. In this example we have used the blood transcript modules curated by Li et. al. in ‘Li, S., Rouphael, N., Duraisingham, S., Romero-Steiner, S., Presnell, S., Davis, C., … & Kasturi, S. (2014). Molecular signatures of antibody responses derived from a systems biology study of five human vaccines. Nature immunology, 15(2), 195.’. The pvalues were generated using QuSAGE methodology.
We can now investigate the comparisons between pathotypes using the volcano_trio function.
syn_mod_plots <- volcano_trio(polar = syn_mod_polar,
label_rows = c("M156.0", "M37.2"),
shared_legend_size = 1,
sig_names = c("Not Sig",
paste("Padj <", 0.05),
paste("|FC| >", 1),
paste("Padj <", 0.05,
"&\n|FC| >", 1)),
share_axes = FALSE)
syn_mod_plots$AllOr a ggplot static image using radial_ggplot:
radial_ggplot(polar = syn_mod_polar,
label_rows = c("M156.0", "M37.2"),
marker_size = 2.7,
label_size = 5,
axis_lab_size = 3,
axis_title_size = 5,
legend_size = 10) We can then interrogate any one specific variable as a boxplot, to investigate these differences.
plot1 <- boxplot_trio(syn_mod_polar,
value = "M156.0",
test = "wilcox.test",
levels_order = c("Lymphoid", "Myeloid", "Fibroid"),
box_colours = c("blue", "red", "green3"))
plot2 <- boxplot_trio(syn_mod_polar,
value = "M37.2",
test = "wilcox.test",
levels_order = c("Lymphoid", "Myeloid", "Fibroid"),
box_colours = c("blue", "red", "green3"))
ggpubr::ggarrange(plot1, plot2)If you use this package please cite as:
Lewis, Myles J., et al. ‘Molecular portraits of early rheumatoid arthritis identify clinical and treatment response phenotypes.’ Cell reports 28.9 (2019): 2455-2470.
or using:
##
## To cite package 'volcano3D' in publications use:
##
## Katriona Goldmann and Myles Lewis (2020). volcano3D: Interactive
## Plotting of Three-Way Differential Expression Analysis.
## https://katrionagoldmann.github.io/volcano3D/index.html,
## https://github.com/KatrionaGoldmann/volcano3D.
##
## A BibTeX entry for LaTeX users is
##
## @Manual{,
## title = {volcano3D: Interactive Plotting of Three-Way Differential Expression
## Analysis},
## author = {Katriona Goldmann and Myles Lewis},
## year = {2020},
## note = {https://katrionagoldmann.github.io/volcano3D/index.html,
## https://github.com/KatrionaGoldmann/volcano3D},
## }